<?php

namespace app\models\tableModel\base;

use Yii;

/**
 * This is the model class for table "{{%user}}".
 *
 * @property int $id
 * @property string $user_name 账号
 * @property string $nick_name 昵称
 * @property string $password 密码
 * @property string $salt 加密字符
 * @property int $sex 性别
 * @property string $avatar 头像
 * @property string $phone 电话号码
 * @property string $description 个人说明
 * @property int $add_time 注册时间
 * @property int $update_time 更新时间
 * @property string $reg_ip 注册IP
 * @property int $status 状态
 */
class User extends Base
{
    /**
     * {@inheritdoc}
     */
    public static function tableName()
    {
        return '{{%user}}';
    }

    /**
     * {@inheritdoc}
     */
    public function rules()
    {
        return [
            [['user_name', 'password', 'avatar', 'phone'], 'required'],
            [['sex', 'add_time', 'update_time', 'status'], 'integer'],
            [['user_name'], 'string', 'max' => 20],
            [['nick_name'], 'string', 'max' => 100],
            [['password'], 'string', 'max' => 32],
            [['salt'], 'string', 'max' => 10],
            [['avatar', 'description'], 'string', 'max' => 200],
            [['phone'], 'string', 'max' => 11],
            [['reg_ip'], 'string', 'max' => 15],
        ];
    }

    /**
     * {@inheritdoc}
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'user_name' => '账号',
            'nick_name' => '昵称',
            'password' => '密码',
            'salt' => '加密字符',
            'sex' => '性别',
            'avatar' => '头像',
            'phone' => '电话号码',
            'description' => '个人说明',
            'add_time' => '注册时间',
            'update_time' => '更新时间',
            'reg_ip' => '注册IP',
            'status' => '状态',
        ];
    }
}
